<template>
  <div class="btn-list">
    <div @click="setClick" :style="{fontFamily:_style_com.fontFamily,direction:_style_com.direction,fontSize:_style_com.fs}" :class="isDis?'dis':''" class="btn three-d">
      {{ text }}
      <div :class="color"  class="text">{{ isDis?'0':chance }}</div>
    </div>
  </div>
</template>

<script>
export default {
	  props:['text','isDis','chance'],
	  methods:{
      setClick(){
          if (this.isDis) return;
          uni.vibrateShort();
          uni.vibrateShort();
          this.$emit('click')
        }
	  },
  computed:{
      color(){
        if (this.chance===1){
          if (this.isDis){
            return ''
          }
          return 'red'
        }else {
          return ''
        }
      },
    _style_com(){
      return this.$t('style')
    }
  }
}
</script>

<style scoped>
.text{
  position: absolute;
  right: -10rpx;
  top:-10rpx;
  background-color: #000;
  border-radius: 100%;
  width: 40rpx;
  height: 40rpx;
  text-align: center;
  line-height: 30rpx;
  font-weight: bold;
}
.red{
  background-color: rgb(204, 70, 61)!important;
  animation: red .4s infinite;
  font-size: 27rpx!important;
  line-height: 35rpx!important;
}
@keyframes red {
	0%{
		transform: scale(1.2);
	}
	100%{
		transform: scale(1);
	}
}
.btn {
  position: relative;
  height: 80rpx;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 30rpx;
  cursor: pointer;
  user-select: none;
  border-radius: 20rpx;
  box-sizing: border-box;
  padding: 0 50rpx;
  font-weight: bold;
  outline: none;
  text-decoration: none;
}
.three-d {
  color: #fcd814;
  background-color: #24a4ff;
  box-shadow: 0 15rpx 0 0 #1580c8;
  text-shadow: -1px 1px 1px rgba(252, 216, 20, 0.5);
  transition: all .1s;
}
.dis{
  box-shadow: unset!important;
  opacity: 0.5;
  transition:unset!important;
  
}
.dis .text{
	  line-height: 38rpx!important;
  }
.dis:active{
  transform: unset!important;
  box-shadow: unset!important;
}
.three-d:hover {
  background-color: #24a4ff;
}

.three-d:active {
  transform: translate(0,4px);
  box-shadow: 0px 1px 0px 0px #1580c8;
}
</style>